package com.system.connect.springboot_flowers.controller;
import com.system.connect.springboot_flowers.service.SubscribeService;
import com.system.connect.springboot_flowers.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/subscribe")
public class SubscribeController {
    @Autowired
    private SubscribeService subscribeService;

    @PostMapping
    public R subscribe(@RequestParam String email) {
        if (subscribeService.subscribe(email)) {
            return R.success("订阅成功！");
        }
        return R.error("您已经订阅过了！");
    }
}
